<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        position: relative;
        width: 80px;
        height: 30px;
        border: 1px solid orangered;
        text-align: center;
        line-height: 30px;
        color: #333;
        font-size: 14px;
        margin-left: 5px;
      }
      .box span {
        margin-left: -10px;
      }
      .box span::after {
        display: block;
        position: absolute;
        right: 12px;
        top: 10px;
        content: '';
        transform: rotate(-45deg);
        width: 6px;
        height: 6px;

        border-left: 1px solid orangered;
        border-bottom: 1px solid orangered;
      }
      .box div {
        width: 80px;
        height: 30px;
        border: 1px solid orangered;
        margin-left: -1px;
        color: #333;
        display: none;
        background-color: #fff;
      }
      .box div:nth-child(2) {
        border-bottom: none;
      }
      .box div:nth-child(3) {
        border-bottom: none;
      }
      .box:hover {
        background-color: #ccc;
        color: orangered;
      }
      .box div:hover {
        background-color: #fff5da;
        color: orangered;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <span>微博</span>
      <div>私信</div>
      <div>评论</div>
      <div>@我</div>
    </div>
  
    <script>
      //1.事件源
      var box = document.querySelector('.box ');
      var div = document.querySelectorAll('.box div');

      //2.事件类型
      box.onmouseover = function () {
        //3.事件代码
        // this.style.display = 'block';
        div[0].style.display = 'block';
        div[1].style.display = 'block';
        div[2].style.display = 'block';
      };
      box.onmouseout = function () {
        //3.事件代码
        // this.style.display = 'block';
        div[0].style.display = 'none';
        div[1].style.display = 'none';
        div[2].style.display = 'none';
      };
    </script>
  </body>
</html>
